package Ontology;

import dbindex.Language;
import dbcontext.AttrTable;

public class Attributes
{
    private int iAttrID;				//	Identifier of attribute
    private String sAttrName;			//	Name of attribute
    private int iAttrType;				//	0 - simple, 1 - input, 2 - output - see database structure
    private boolean bIsMarked;			//	marked	2think
    private String sAttrDescr;			//	Description of attribute
    private String sStemAttrName;		//	Stemmed Name of attribute
    private String sStemAttrDescr;		//	Stemmed Description of attribute

    /*		to another class
    private int iDomTypeID;		//	ID of attribute domain 
    private int iMin;			//	Attr.Min
    private int iMax;			//	Attr.Max
    */

    /**
     * @deprecated replaced by Attributes with sStemAttrName
     */
    public Attributes ( int iiAttrID, String isAttrName, int iiAttrType, String isAttrDescr )
    {
    	iAttrID = iiAttrID;
    	sAttrName = isAttrName;
    	iAttrType = iiAttrType;
    	sAttrDescr = isAttrDescr;
    }

    public Attributes ( int iiAttrID, String isAttrName, int iiAttrType, String isAttrDescr, String isStemAttrName, String isStemAttrDescr )
    {
    	iAttrID = iiAttrID;
    	sAttrName = isAttrName;
    	iAttrType = iiAttrType;
    	sAttrDescr = isAttrDescr;
    	sStemAttrName = isStemAttrName;
    	sStemAttrDescr = isStemAttrDescr;
    }

    public String toString() 
    {
        return "AttrID: " + iAttrID + " AttrName: " + sAttrName + " AttrType: " + iAttrType;
    }
    public String toFile() 
    {
        return "AttrID:\n" +  
    	iAttrID + "\n" +
    	iAttrType + "\n" +
    	sAttrName + "\n" +
    	sAttrDescr;
    }
    public String toFileWithTab() 
    {
        return "" +  
    	iAttrID + "\t" +
    	iAttrType + "\t" +
    	sAttrName + "\t" +
    	sAttrDescr;
    }
    
    /** Stores data to the table 'attr' */
    public void toDatabase( java.sql.Connection conn, 
                            Language lang,
                            int onto_id, int base_onto_id)
    {
        AttrTable.insert( conn, lang, iAttrID, iAttrType,
                          onto_id, base_onto_id, sAttrName, sAttrDescr);
    }
    
    public int getAttrID() 
    {
        return iAttrID;
    }
    public int getAttrType() 
    {
        return iAttrType;
    }
    public String getAttrName() 
    {
        return sAttrName;
    }
    public String getStemAttrName() 
    {
        return sStemAttrName;
    }
    public String getAttrDescr() 
    {
        return sAttrDescr;
    }
    public String getStemAttrDescr() 
    {
        return sStemAttrDescr;
    }
    public boolean getIsMArked() 
    {
        return bIsMarked;
    }
    public void setIsMarked( boolean ibIsMarked ) 
    {
        bIsMarked = ibIsMarked;
    }
}